import Vue from 'vue';
import VueRouter from 'vue-router';
import home from '../views/home.vue';

Vue.use(VueRouter);

const routes = [
	{
		path: '/',
		name: 'home',
		component: home,
		redirect: 'index',
		children: [
			{
				path: 'index',
				name: 'index',
				component: () => import(/* webpackChunkName: "index" */ '../views/index'),
				meta: {
					showTab: true
				}
			},
			{
				path: '/index/bargain',
				name: 'bargain',
				component: () => import(/* webpackChunkName: "bargain" */ '../views/index/bargain.vue'),
				meta: {
					title: '砍价列表'
				}
			},
			{
				path: '/index/special',
				name: 'special',
				component: () => import(/* webpackChunkName: "special" */ '../views/index/special.vue'),
				meta: {
					title: '严选专栏'
				}
			},
			{
				path: '/index/specialDetail',
				name: 'specialDetail',
				component: () => import(/* webpackChunkName: "specialDetail" */ '../views/index/specialDetail.vue'),
				meta: {
					title: '专栏详情'
				}
			},
			{
				path: 'type',
				name: 'type',
				component: () => import(/* webpackChunkName: "type" */ '../views/type/type.vue'),
				meta: {
					showTab: true
				}
			},
			{
				path: 'cart',
				name: 'cart',
				component: () => import(/* webpackChunkName: "cart" */ '../views/shopcart/cart.vue'),
				meta: {
					showTab: true
				}
			},
			{
				path: 'me',
				name: 'me',
				component: () => import(/* webpackChunkName: "login" */ '../views/me/me.vue'),
				meta: {
					showTab: true
				}
			},
		]
	},
	{
		path: '/login',
		name: 'login',
		component: () => import(/* webpackChunkName: "login" */ '../views/login/login.vue'),
	},
	{
		path: '/forGotPass',
		name: 'forGotPass',
		component: () => import(/* webpackChunkName: "forGotPass" */ '../views/login/forGotPass.vue')
	},
	{
		path: '/register',
		name: 'register',
		component: () => import(/* webpackChunkName: "register" */ '../views/login/register.vue')
	}
];

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
});

export default router;
